import type { AddressItem, Logistics, OrderDetail, OrderPre } from "@/types/order";
import { request } from "@/utils/request";

// 查询药品订单预支付信息
export const getMedicalOrderPre = (parmas: {prescriptionId: string}) => 
    request<OrderPre>('patient/medicine/order/pre', 'GET', parmas)
    
// 查询收货地址
export const getAddressList = () => 
    request<AddressItem[]>('/patient/order/address', 'GET')

// 药品支付
export const createMedicalOrder = (data: { 
    id: string
    couponId: string
    addressId: string
 }) => request<{ id: string }>('/patient/medicine/order', 'POST', data)

// 药品订单信息
export const getMedicalOrderDetail = (id: string) =>
  request<OrderDetail>(`/patient/medicine/order/detail/${id}`)

// 查询物流信息
export const getMedicalOrderLogistics = (id: string) => 
 request<Logistics>(`patient/order/${id}/logistics`, 'GET')